home *** CD-ROM | disk | FTP | other *** search
/ New Masters of Flash / New Masters of Flash.iso / pc / MOVIES / 05.dir / 00223_Text_text18.txt < prev    next >
Text File  |  2000-10-01  |  3KB  |  32 lines

  1. Frame 9: 
  2. (label: Refresh Editing View) Refreshing the Editing View
  3.  
  4. The script contained in this frame refreshes the editing view that the user sees when they press one of the XYZ buttons and is called from the script within these buttons.
  5.  
  6. Frame 9 is basically the reverse of frame 8. Where frame 8 reset the x, y and z co-ordinates of the individual points in the 3D view based on the positions of the points in the editing view, frame 9 sets the positions of the points in the editing view relative to the points in the 3D view. The script in this frame is executed when the viewer presses one of the X, Y, and Z buttons in the top right-hand corner.
  7. The scripts used in frames eight and nine can be a bit hair-raising but letΓÇÖs look at how this could work for you. IΓÇÖll recap and summarise what weΓÇÖve been doing throughout the movie.
  8.  
  9. First we set the individual vertex coordinates (Variables:"x1","y1","z1", "x2", etc.) which gave the individual points a position in the ΓÇÿworldΓÇÖ ( frame 2 ).
  10. Then we set rotation angles (Variable:"Xangle" and "Yangle")  based on the position of  "/Mouseloc" (frame 6).The above rotation angles, and the vertex coordinates and the "perspective" variable were then used by the script in frame 7 (3D Calc) to derive at a X and Y screen coordinate for each point, as well as a scale value.  The point that I want to emphasize here is that the script in frame 7 (3D Calc) is continually executed, each time taking the vertex coordinates, rotation angles and perspective value and calculating new screen coordinates for each point. 
  11.  
  12. So, essentially, you could change any of these variables at any time and the 3D view will be updated.  This is what we did in frame 8, where we changed the original x, y and z coordinates for the individual points. These changed variables are then being used by frame 7 to calculate new screen coordinates.
  13. LetΓÇÖs do a little experiment:
  14.  
  15. Change the script in frame 4 ( Label: "Main Looping Script") to read:
  16.  
  17. call ("Refresh 3D View"0;
  18. call ("Mousetracking"0;
  19. call ("Calc3d);
  20. Delete the script in frame 8 (Label "Refresh 3D View) and replace it with the following script:
  21.  
  22. z5 = z5+madd;
  23. if (z% >100 or z% < -100) {
  24.   madd = -madd
  25. }
  26. Add this line in frame 3 (label: "Setup"):
  27.  
  28. madd = -10;
  29. When you run the movie, youΓÇÖll see that "/Vertex5" automatically moves forward and backwards on the Z-Axis.  This is because weΓÇÖre continually adding the value of Variable: "add"  (which starts out as ΓÇö10) to Variable: "z5" which represents its z ΓÇöcoordinate.  If the value of Variable: "z5" is smaller than ΓÇö100, or greater than 100, Variable: "add" is set to ΓÇöadd.  This constrains the movement to a limit of 100 units away from the center point.
  30. This is just a simple example of how the position of individual points could be controlled but you can create more complex movements.  Experiment 5 on www.wireframe.co.za is based on this principal. If youΓÇÖre a game developer, you could base a number of interesting games on this method.
  31. Whether you simply want to create a rotating 3Dmenu (remember,  the individual points can contain any graphic or buttons, even text) or whether you want to pursue something more complex, such as the creation of a 3D game, this technique should come in very handy.
  32.